/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package Basicas;

import java.io.BufferedInputStream;
import java.io.FileNotFoundException;
import java.io.FileOutputStream;
import java.io.IOException;
import java.util.ArrayList;
import java.util.zip.ZipEntry;
import java.util.zip.ZipInputStream;

public class Zip {
    public static void Descompactar(BufferedInputStream conn)
    {
			
	ArrayList<String> Arquivos = new ArrayList<String>();
	ZipInputStream connZip = new ZipInputStream(conn);  
        ZipEntry arquivoZip = null;  
              
        try {
            while ((arquivoZip = connZip.getNextEntry()) != null) 
            {  
		Arquivos.add(arquivoZip.getName());
		FileOutputStream gravar = new FileOutputStream("C:\\TutorialArquivos\\"+arquivoZip.getName());  
                    for (int i = connZip.read(); i != -1; i = connZip.read()) 
                    {                    
			gravar.write(i);                    
                    }  
				    
                    connZip.closeEntry();  
                    gravar.close(); 
            }
            } catch (FileNotFoundException e) 
            {
		e.printStackTrace();
            } catch (IOException e) 
            {
		e.printStackTrace();
            }  
            try 
            {
		connZip.close();
            } catch (IOException e)
            {
            e.printStackTrace();
            }  

    }
}
